The Edge Of The World is an Action RPG game prototype, which include typical RPG elements such as: fighting with monsters, spell casting, abilities and more. The main elements that help the prototype to stand out are: advanced spells system, abilities system, effects system and combat system.
Game design was a core element of the development. I had to define the main elements of the game such as it's genre, core mechanics and the main story.
Player will be playing as powerful paladin. Thrown into fantasy world, he will try to help the small town located at the edge of the world. Having a powerful spellbook at his disposal he will be able to cast powerful spells. As a great warrior, player will also be able to fight with various creatures using his sword.
The main task of the player will be to put an end to infinite war between demons and the people from the town who try to stay alive. Wave after wave, more demons are coming and only the paladin can change the situation and bring back the peace. In the game there will be various enemy and friendly units. Creatures can perform melee, ranged or combined attacks.
The game will allow the player to apply various gameplay effects on his character as well as on other characters, both friendly and opponents. These effects can help the player to shape the battlefield in the player's favour. To defeat the evil, player must collect enough souls in order to close all the portals or find and destroy them all.
Core Objectives of the game:
𠈬ollect 300 souls from destroyed demons
stroy all portals from which the demons came
Genre: Third-Person Action RPG
Game World Setting:
The game will take place outdoor in a colourful location. Player will start in a small town which is surrounded by mountains. There will be interactive elements such as creates and boxes. Player will be able to destroy them in order to find some useful resources. The most of the obstacles types will be represented by town buildings, rocks, tress from the forest and impassable mountains. In order to increase the complexity of the scene, foliage and water will be added as cosmetic elements.
The world itself is a classic fantasy world which means fantastic beasts, abilities and of course magic.
Perspective:
The player will be visible from a Top Down Perspective. Camera will always follow the player. Camera is placed above the character's head, at the height of the medium size house.
Camera is not statically tied to a player. It can be rotated and moved up and down to a certain level.
Visual Style: Dark, Magical, Fantasy
Details:
Spellbook System consists of two main elements: spellbook itself and spells. Spellbook is just a container which provides an access to available spells. All spells are sorted based on the sphere of magic they belong to. Player can easily select the sphere of magic and cast the spell from this sphere.
Spellbook also provides an additional resource for the player: mana. Mana is used for spell casting. Each spell has a certain mana cost and a chance of success (spell cast can be unsuccessful !).
Usage Scenario I - Successful Spell Cast:
Player pressed the button associated to the Ring Of Fire spell. The spell is successful, required mana is taken from the total mana resource amount and the ability which apply damage to all nearby enemies has been used. If there are any enemies around the player, the damage will be applied to them all(if they are within the ability radius).
Usage Scenario II - Unsuccessful Spell Cast:
Player pressed the button associated to the Ring Of Fire spell. The required mana is taken from the total mana resource amount but no abilities will be used from the spell.
How it works:
Spellbook is represented graphically by usable buttons with icons. Each button (with icon) provides a direct access to the associated spell. By pressing the button, player can cast the spell if there is enough mana resource in the spellbook.
Each spell has a fixed chance of success which is measured in % with minimum value of 0 and maximum value of 100. Before the spell is casted (but after the mana resource has been taken), the calculation of the cast success is performed. Depending on the calculation outcome(Successful/Unsuccessful), all the abilities stored by the spell are being used or nothing will happen- in case, the spell is unsuccessful.
Each spell contains certain amount of various abilities which make a spell also a type of container for the abilities. Once the spell is casted successfully, all the abilities are being used.
Details:
Abilities System - provides various abilities which can be used by characters or can be used indirectly via other elements (such as spells). Abilities do not require any specific resource type. For this reason, abilities are usually included with other systems like spells or combat system.
There are several different types of abilities including: Ability-Self and Ability-Area Of Effect. Ability-Self affects only ability user (ie player character) and Ability: Area Of Effect affects user and all the characters in the certain radius from the user location.
Usage Scenario I - Ability-Self:
Player pressed the button responsible for activating the “Heal-Self” spell. This spell has only one ability. Ability is of type self, so it will only take effect on the user (in this case- spellcaster). Spell cast was successful and the ability is being used. 20 health point s have been added to Player character health amount.
Usage Scenario II - Ability-Area Of Effect:
Player pressed the button responsible for activating “Ring Of Fire” spell. This spell has only one ability. Ability is of type Area Of Effect, so it will take effect on the user and all the characters within a certain radius from the ability user (in this case-player character). “Ring Of Fire” has the ability which apply 20 damage to any character within the 100m from the player character. Additionally, it will only damage enemy characters so in effect, all friendly characters and the player character itself will be ignored.
How it works:
Abilities can contain various properties such as: damage, health to add and radius. After ability is used, the damage and health values are immediately applied on the target characters. Each type of the ability works differently.
Ability-Self is being applied directly on the user. Any damage/health values will be applied on him and there is no radius needed.
Ability-AreaOfEffect is being applied on all characters within the specified radius. Radius is represented by simple collision sphere in 3D space. The origin point of the sphere is at the ability user location (eg player character). Overlapping characters will receive any effects from the ability. For example all characters who are not in the ability user team, will receive damage value from the ability. On the other hand, all friendly characters may receive additional health points or other effects.
Each ability might also contain the number of effects to apply on the target character. Effects include elements such as buffs/debuffs that are usually long lasting(or permanent) effects on the character. For example an ability can apply permanent damage to target character or add additional health temporarily.
Effects System:
System which allows for applying long lasting effects such as buffs and debuffs to any characters in the game. Effects have several main properties such as effect duration, number of intervals, target stats changes, icon, name, description and type. Effects can affect characters stats
Effects can be applied on character indirectly (via other systems or game elements). All effects applied to a specific character are saved and can be displayed with the help of graphical elements such as interactive images with effects icons (icon textures). Player can examine all the effects applied on the player character by looking at the active effects panel which is rendered as container of active effects, represented graphically by rectangle images.
Usage Scenario - Player used healing spell which has an ability with only one effect
Player used healing spell which has an ability with only one effect. Spell cast is successful and ability is used which immediately adds 20 health points to player character. Additionally, healing effect is being applied on character which leads to character being healed once per second for the total duration of 5 seconds. The effect is a permanent effect. The effects adds 5 health to character in each interval. This means that effect duration is 5s, number of interval is 5 and thus the interval duration lasts 1s. Player will gain the total of 25 health points from this effect, 20 from the ability, so the player received the total of 45 health points after use of the healing spell.
How it works:
Each effect can affect target character stats(health, speed, armor etc.) temporarily or permanently. Because of this there are two main types of effects: temporal and permanent. Permanent effects modify the target stats permanently (e.g. applies 20 damage to target character ). On the other hand, temporal effects modify the stats only for the duration of the effect. This means that any changes will be reversed after the effect has expired. The great example is a armor buff effect which can add +5 armor to target character stats. The effect duration is 5 seconds. This gives +5 armor buff which lasts exactly 5 seconds. If target character had 10 armor before the effect has been applied, he will has 15 armor and after the effect is expired, the armor value will be again 10.
Each effect also has its own type such as: burning, poison, healing etc. Only one effect from each type can be active. For example if poison effect is already active on the target character, only effects with type other than poison can be applied. Furthermore the new effect to apply will be evaluated and compared to the current, active one. If the new effect seems to be the more powerful one (ie has longer duration/more damage/more health to add) then it will replace the current effect. Otherwise, the new effect with the same type it will not be applied.
Characters can be resistant to some or all the effects. For example if character is resistant to poisons, any poison effect will be ignored on this character (ie it can't be applied).
Details:
Combat System - provides both melee and ranged combat for the characters.
Melee Combat - character can attack the targets with specified speed (time between the intervals/attacks) and distance. Once the target is selected and it is within the reachable distance, the attacking character can start performing melee attack which includes correct animation montage and modification of the target's stats.
Ranged Combat - works the same as melee combat but it also can launch projectiles objects in the target direction. The projectile launch origin is usually equal to the attacker position.
Weapons and projectiles can be represented by 3D models in order to increase the graphical complexity and add more depth to the combat.
Usage Scenario I - Melee Combat:
Player selected a nearby enemy character as the target. After the player character reached the required attack distance which is 10 meters in this example, the attack can be performed. Player character attack once per 2 seconds and apply 20 damage to the target character.
Usage Scenario II - Ranged Combat:
Player selected a nearby enemy character as the target. After the player character reached the required distance which is 70 meters in this example, the ranged attack can be performed. Player character attacks and launches the projectile in the target direction. If there is projectile-target collision detected, 15 damage is being applied to the target.
How it works:
Combat System can be attached to any character or object in the game. The system immediately provides combat elements to the object. The elements that should be provided by the owning objects are: combat animation and target selection.
The character/object should explicitly set the target for the combat system to work properly. The example of setting the target are: separate selecting system which allow targets selection by mouse hovering and selecting by left mouse button pressing or the target can be set dynamically by the AI characters as they see fit(e.g. can see player ? -> set player character as a target).
Combat System is calculating the distance between the attacking character and the target in the specified intervals (e.g. each 0.1 s). Once the target is within the specified distance, the animation will be player and the attack will be performed.
Player will control the powerful paladin who has been sent to help the town at the edge of the world defeat the evil forces. Next to the town's defensive walls, the great battle takes place. The town's garrison constantly try to push demons back. However, the infinite amounts of new creatures are coming from their portals. There are new recruits constantly coming from the barracks. They jump straight into the battle. Without enough required experience in combat, these fresh recruits are overhelmed by the evil forces.
Blood-thirsty demons know how to fight as they learned useful skills in the Kingdom of Chaos where they fight with each other.
Following the Game Design, I started working on the general architesture of the game and it's elements.
This section presents an analysis of the requirements for the vertical slice, which are derived from the Game Design Document.
The requirements will technically define how the player will interact with the game and provide an overview of his progression through the game.
The following sections illustrate the evolution from the game design through requirements capture to a formal set of use-case scenarios which define both the main gameplay mechanics and the game flow that will result in the player finishing the game, either in a winning or losing position.
Ability Use Case
The player will cast the spell and if spell is successful, the ability stored in the spell will be used on the player or on the nearby targets with the goal to apply damage/add health and apply effects on the ability targets.
Combat Use Case
The player will hover the mouse over the enemy object. Player will select the enemy object and the player character will start to move towards the target location. Once the target is in the attack range, player will start to attack the target using either melee or ranged combat mechanic with the goal of killing/destroying the target object.
Demon Portal Destruction Use Case
Player will identify the demon portal and will try to attack it. After the health of the portal object is equal to 0, the portal will be destroyed. This portal will also stop the spawning of new demons and will count towards the player win condition by destruction of all the portals.
Effect Use Case
The player will cast the successful spell and the ability will be used. Ability will use the stored effect and will apply that effect on the player or on the ability targets with the goal to apply various buffs/debuffs on the affected targets.
Stats Modification Use Case
Player will perform various actions with the goal to boost the player character stats and to also impact enemy and ally stats. With the help of combat mechanics, projectiles, abilities and effects player will be able to modify the stats of any objects in the game.
Player Character Movement Use Case
The player will select any walkable area on the level and the controlled character will start to move towards the selected target location with the goal to reach that location or to try and reach the closest location from the target location.
Pickup Up Item Use Case
The player will collided pickable items by moving a player character towards them. Collision detection will be performed between the player character and the pickup item. If collision has been detected, then the item will be destroyed and appropriate effects will be applied on the player character.
Selecting Object Use Case
The player will use mouse input in order to hover and select interactable objects such as pickup items, enemies, allies etc. Selected objects will be highlighted on colour which will depend on the object's team(Enemy/Ally) or if the object does not contain any information about team, then it will be considered as neutral
Spell Casting Use Case
The player opens the spellbook from the player UI. Player will hover the mouse over the desired spell icon. Player will select and press the spell icon. The spell will be casted with the goal to use spell abilities at the caster location and mana resource will be drained by the amount equal to the spell cost.
Unified View Use Case Diagram
Use Case Analysis Of Game Flow - Winning Condition
Use Case Analysis Of Game Flow - Losing Condition
Abilities System
Combat System
Effects System
Spellbook System
VERTICAL SLICE APPLICATION GAME STATE FLOW ACTIVITY DIAGRAM
Ability UML Class Diagram
AI Character Class UML Diagram
Combat Component UML Class Diagram
Effect UML Class Diagram
Hero Player Controller UML Class Diagram
Manager UML Class Diagram
Player Hero UML Class Diagram
RPG Character Base UML Class Diagram
Selectable Actor Component UML Class Diagram
Spellbook Component UML Class Diagram
Spell UML Class Diagram
Application Core Architecture Diagram
Application Core Architecture Diagram Part 2
Spatial Layout Colour Legend
Spatial Layout - Top_Lit
Spatial Layout - Top_Unlit
Spatial Layout - Front
Spatial Layout - Back
Spatial Layout - Left
Spatial Layout - Right
The system has been developed with Game Designers in mind, thus a lot of work has been put into spell customisation, data-driven spell creation and general editing with the help of UE4's powerful Blueprint Archetypes and Structs. Game Designers can modify spell as he see fit with almost all elements of the spell being editable via Blueprint Archetypes.
The system has been designed and implemented in a way to provide the freedom of spell creation and customisation. There are several different ways to change spell properties
Spell system has been implemented almost entirely using UE4's actor component class which allows for attaching/detaching of the component in non-destructive way and it can be very easy to attach and incorporate the component to other characters or actors (why not attach the spellbook component to a building or other static object ?)
Spell is one of the main elements of the Spells System. Spells is an Actor(AInfo) class which can be instantiated.
Main tasks of the Spell class include:
Providing a base class for other spells that can be derived from the base class
Providing flexible and customisable Spell Struct
Spawn all the abilities stored in the spell class
Spell can be used via Cast Spell function call. This will take a pointer to the caster Actor and will save it for this spell as a member pointer variable of type AActor*. Additionally, function Should Cast will calculate if the spell is successful (based on the Success Chance) and will return whether the spell is successful or not. Then all the spell's abilities will be spawned via the Use Abilities function.
After calling a successful Cast Spell function, the spell will try to spawn all the stored abilities. For this purpose, the access to Abilities Manager is needed as this is the class responsible for Abilities creation.
Using range for loops, all the Abilities will be instantiated and the Use Ability function will be called on each instance.
Inside the Use Ability function, the pointer to newly created ability will be added to the Active Abilities array and the actual Use Ability function will be called on the Ability instance. This will apply any effects that ability contain and will continue its own logic.
Spell Struct is one of the most important parts of the spell class. This struct specify all the initial properties for the spell instances. Spell Struct is a UStruct type and is also derived from FTableRowBase to allow struct editing inside Data Tables. The struct itself uses meta specifiers for properties visibility and editing.
On the picture below, we can see the Data Table inside UE4 editor. Currently the “Blessing” spell is selected and we can now customise the spell (or leave it as it is).
We can expand the “Customised Abilities” array which stores all the abilities we customised inside the Spell Struct. Here we can add customized abilities to our spells, specify their type, base class, particle system etc. At the bottom of the picture we can set the Stats Modifier Struct which is used to modify ability targets stats (such as Health, Armor etc.)
We can also use one of our premade Effect classes to avoid customization by hand. Premade Effect classes are just child classes of the base Effect class (they can be also derived from other derived Effect classes). The Effect will be spawned with the default class values that we chose as our Effect class.
Here we can see what happened after casting our “Blessing” spell. We can still see the particles system spawned at the position of player character and on the left hand side we can see the panel with Active Effects. This panel will show any Effects that are applied on the player character and will provide more info about the Effect after hovering over the Effect icon.
Each spell need to be assign to one of the Magic Spheres. Magic Sphere cannot be instantiated and is represented only by Magic Sphere Struct.
Similar to Spell Struct, Magic Sphere Struct can be edited in Data Table.
Currently there are three types of Magic Spheres, but more can be added.
Spell is created after pressing the related button inside the Spellbook Widget.
However it cannot spawn the spell directly. Spells can be created via the Spells Manager.
This Manager class is responsible for the instantiation/updating/destruction of the spell.
The Manager itself is an extension of the Manager Base class which is a base for all managers within the API.
Spells Manager has got several key functions which are used for updating of Spell class instances and creating new instances. There is also a Clear function which is responsible for clearing of the inactive spells.
There are also two key members of this class: Active Spells Array and Inactive Spells Array. After Spell class instantiation, the pointer to newly created instance will be stored in the Active Spells Array. After the spell will become inactive, it will go to Inactive Spells array and it will be removed from there during the Clearing operation.
We can see the vital function from the Spells Manager: Create Spell. In this case the spell will be instantiated from the specified Spell Class. If the instance has been created successfully, the pointer to the newly created spell will be added to the Active Spells array from where it can be updated. We can also see the Set Should Update function which is related to the Spells Manager itself and it ensures that this manager will be updated in specified intervals.
Inside the Tick function which is called in specified intervals, all spell instances from the Active Spells array are being updated. If the spell from the update loop is not active, then it will be added to Inactive Spells array. Additionally after all the instances have been updated, using lambda functions all pointers to inactive spells will be removed by predicate from the Active Spells array. Also the Clear function will be called if its interval has expired.
Finally if both arrays are empty, we can deactivate the manager (for now).
Clear function will call Auto Destroy function on each inactive instance (which will destroy the spell instance) and then will clear the whole Inactive Spells array.
Spellbook will load the spell structs from the SpellsList into the correct Magic Spheres structs that are stored in the Magic Spheres data structure which is of type TMap, where Magic Spheres (enum/integer) represent map keys and Sphere Structures (Sphere Structs) represent map values.
Spellbook will load all the spell structs into Spells List TMap. Spell structs will be retrievied (their copy) from the Spells Data Table (if there is one specified).
If the Spell has been found, the mana resource will be decreased by the spell mana cost (if there is enough mana).
Then the spell will be created via the SpellsManager.
If everything was successful, the Cooldown period will be triggered (spellbook cannot cast spells during the cooldown period). Additionally On Spell Cast delegate will be called to let the all listeners know that the spell has been casted.
Spellbook Component can be attached to any Actor. Below is an example of attaching this component to player hero character in C++.
Attached Spellbook can be edited in UE4 editor.
User can specify the Data Tables, mana resource values and regeneration and he also can add new spells directly in the Spells array.
Player can also click the white box which is positioned on the left side of the book. This will display extended spell info with all abilities and effects that will be applied after spell cast.
Spellbook Widget consists of other widgets and such as Effects Info Panel, images and buttons.
All widget within the Spellbook Widget will be initialised inside the Initialise function.
Abilities are the main elements of the spell. They are responsible for spawning sounds, particle effects, collision detection, applying any damage and other stats changes to the targets and also can spawn its own gameplay effects to further buff/debuff their targets.
Abilities are represented by classes derived from Epic's Actor class. This means that Abilities can be placed into the world and can have graphical representation.
Ability is an actor that can be invoked by spells or directly by any actor and they are used to affect other actors. They can apply damage or heal other actors and additionally they can spawn effects to further modify the stats.
There are 2 main types of abilities available in the game:
Self ability directly affect the caster. It might apply certain effects or immediately modify the caster's stats. Below is the example of ability used on the player to heal his wounds.
AOE ability affect the actors in certain radius around the caster. It might be used to heal the player allies or to damage his opponents. Here is the example of the AOE ability spawned by the spell which damages all enemy units around the player.
Abilities can be built and customized in editor as a part of spell building.
Abilities can be spawned via other systems with use of specialised class - Abilities Manager which is used for Ability spawning, updating and clearing
Abilities Manager has got several key functions that are used for updating of Ability class instances and creating new instances. There is also a Clear function which is responsible for clearing of the inactive abilities.
Effects are the additional elements that can be invoked by the abilities. They can affect the target actor's stats permanently or temporarily. They mainly play a role of buffs and debuffs. We can for example grant a temporary armour or attack bonus, but these additions can also be permanent.
Effect is a class directly derived from UObject, hence it's lower in a class hierarchy than spells and abilities. I decided to use UObject as a base class, because the effects don't have any graphical representation and they don't have to be spawned in a level.
Similarly to the ability class, effect s can be added to abilities as a part of spell building. Designer can use a premade effect class which is simply an UObject derived from the base Effect class with all elements such as stats modifiers and descritpion alredy set.
Additionally, Game Designer can add a customized effect. This allows the designer to use advanced effect settings.
Applied spells are graphically represented by UI elements containing the effect icon and detailed description.
Effects Manager has got several key functions that are used for updating of Effect instances and creating new instances. There is also a Clear function which is responsible for clearing of the inactive effects.
Combat system provides Melee and Ranged combat functionality to every actor that has a Combat Actor Component attached to it. The combat system also includes the animation and animation notifiers that are an integral part of the system.
Using this component, the Actor can perform melee or ranged attack.
Both modes can be used so that the melee attack will be triggered in close combat and the ranged attack will be used if the target is in range, but still not close enough to perform a melee attack.
Melee Combat can be customized in component's settings. Properties such as range and animation montage can be set here.
Melee combat is triggered, once the actor is close enough its target. It will stop the actor's movement and will perform the melee attack.
The melee attack animation montage is also played.
Ranged Combat can be also customized in component's settings. Properties such as range and animation montage can be set here.
Ranged attack is triggered, once the actor is within the range attack range. It will stop the actor's movement and launch a projectile of chosen class. Any stats modifications to the target such as damage and effects will be applied once the projectile hit the target.
The ranged attack animation montage is also played.
Both Melee Attack and Ranged attack can be called externally by other systems. In this case, they are called after the Start Attack function, which notifies the Animation System to start an animation montage.
The attack notifier can be placed anywhere in the animation montage. In this example there are 4 distinct animations in this montage with various points wheer the actual attack notifier is called.
The Animation Notifier Blueprint class will call the attack function explicitly.